<template>
  <div>
      <h1>我是父组件</h1>
      <h1 v-myshow="flag">自定义指令显示隐藏</h1>
      <button @click="flag=!flag">改变</button>
      <h1 v-copy="'要复制的内容 你好'">要复制的内容 你好</h1>
      <textarea name="" id="" row="20" col="20"></textarea>
      <!-- 子组件传来的数据 -->
      <h1>子传父：{{fmsg}}</h1>
      <h1 v-for="item in flist" >{{item}}</h1>
      <hr>
        <playOne :food="state.fd"
        :price="state.fprice"
        :list="state.flist"
        @sendMsg="getMsg"
        @sendList="getList"></playOne>
        
  </div>
</template>
<script setup>
  import playOne from './playOne.vue'
  import {reactive,ref} from 'vue'

  let state=reactive({
    fd:"父组件的食物：鱼香肉丝",
    fprice:20,
    flist:["鱼香肉丝","宫保鸡丁","红烧肉"]
  })
  // 接受子组件传来的数据
   let fmsg=ref('')
  let getMsg=(msg)=>{
    console.log(msg,"-0-------")
      fmsg.value=msg;
  }
  // 接受子组件传来的数组
  let flist=ref([])
  let getList=(list)=>{
    flist.value=list;
  }
  let flag=ref(true)
</script>